package com.ti.srpglife;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;
import com.badlogic.gdx.graphics.GL10;
import com.badlogic.gdx.Game;
import com.ti.srpglife.Screen.GameScreen;
import com.ti.srpglife.Screen.SplashScreen;
import com.ti.srpglife.world.GameWorld;

public class SRPGLIFEGame extends Game 
{

	public static GameWorld world = new GameWorld();
	
	public SplashScreen getSplashScreen()
	{
		return new SplashScreen(this);
	}
	public GameScreen getGameScreen()
	{
		world.newChunkSet("img/maps/Test.tmx");
		return new GameScreen(this);
	}
	
	public void create() {		
		setScreen(getSplashScreen());
	}

	public void dispose() {
		super.dispose();
	}

	public void render() {
		update();
		
		Gdx.gl.glClearColor(1, 1, 1, 1);
		Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);

		world.render();
		super.render();
	}

	private void update() 
	{
		world.update(Gdx.graphics.getDeltaTime());
	}
	
	public void resize(int width, int height) {
		super.resize(width,height);
	}

	public void pause() {
		super.pause();
	}

	public void resume() {
		super.resume();
	}
	
	public static void main(String[] args) {
		LwjglApplicationConfiguration cfg = new LwjglApplicationConfiguration();
		cfg.title = "SRPGLIFE";
		cfg.useGL20 = false;
		cfg.width = 720;
		cfg.height = 480;
		
		new LwjglApplication(new SRPGLIFEGame(), cfg);
	}
}
